package com.zyk.scaffold.oauth.controller.token;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import javax.validation.constraints.NotBlank;
import java.io.Serializable;

@Data
@ApiModel("租户切换请求信息")
public class TokenLoginTenantRequest implements Serializable {
    private static final long serialVersionUID = -6949882219841285959L;
    @ApiModelProperty(value = "租户编码", required = true)
    private String tenantCode;
    @ApiModelProperty(value = "accessToken", required = true)
    @NotBlank(message = "accessToken不能为空")
    private String accessToken;
    public TokenLoginRequest toTokenLoginRequest(){
        TokenLoginRequest tokenLoginRequest = new TokenLoginRequest();
        tokenLoginRequest.setGrantType("tenant_refresh");
        tokenLoginRequest.getRequestParam().put("tenantCode", tenantCode);
        tokenLoginRequest.getRequestParam().put("accessToken", accessToken);
        return tokenLoginRequest;
    }
}
